Processes, and Threads


The Issue - Concurrency:

We will want to split a job into a number of independent, or semi-independent, processes and or threads on a single system, or across a network, perhaps sharing resources, in order to speed processing.

Software Solutions:

  1. A thread is a path of execution within a process. They are subject to process-like operating system time sharing constraints. A process can contain multiple threads, all sharing the same PID. A critical difference between a thread and a process is that thread of a given process share resources. They can read from and write to the same data structures and variables, facilitating communication between them.
  2. A process can be thought of as a running instance of a program. Simplifying, when you open, say, a browser the operating system creates a process, displaying the browser's Home Page. The operating system assigns each running process a unique Process ID (PID) A good working point of view is that processes do not share resources. Fields and their values available in one process are not in another. One codicil is that operating system or network resources for communication between processes must be available.
     

Process and Thread Design Issues:

The order of execution of processes or threads within a given process may have to be synchronized. As a simple example, if a value is to be computed by one process or thread and then read by another, the designer must be certain that the computation is completed before the value is read. Another example is where two processes or threads go into wait states, each depending on the other to complete a computation.